import React from 'react'
import { Routes, Route, Link, useRoutes, NavLink } from 'react-router-dom'
import routes from './routes'

export default function App() {
  return (
    <div>
      {/* end的作用: 子级路由高亮,则父级路由不高亮. 写在父级的NavLink上面 */}
      <NavLink to="/home" end>
        首页
      </NavLink>
      &nbsp;&nbsp;
      <NavLink to="/login/1">登录页</NavLink>
      <hr />
      {/* 定义前端路由规则 */}
      {/* useRoutes的返回值就是根据路由表生成的Routes和Route */}
      {useRoutes(routes)}
    </div>
  )
}
